<template>
  <ul>
    <li
      v-for="(item,index) in mvss"
      :key="index"
    >
      <div class="cov">
        <img :src="item.imgurl16v9">
        <i
          class="iconfont icon-bofang"
          @click="goMVPlay(item.id)"
        ></i>
      </div>
      <p
        class="dec"
        @click="goMVPlay(item.id)"
      >{{item.name}}</p>
    </li>
  </ul>
</template>

<script>
import axios from 'axios'
export default {
  data () {
    return {
      artID: 0,
      mvss: [],
      nowpage: 1
    }
  },
  created () {
    this.getAllMV()
  },
  methods: {
    // 获取MV
    async getAllMV () {
      this.artID = this.$route.query.id;
      // let offst = (this.nowpage - 1) * 12;
      let res = await axios.get('https://autumnfish.cn//artist/mv?id=' + this.artID + '&limit=12')
      console.log(res)
      this.mvss = res.data.mvs
    },
    // 点击播放按钮，进入播放MV页面
    goMVPlay (id) {
      // 进入MV详情页面
      this.$router.push({ path: '/mv', query: { id: id } })
    }
  }
}
</script>

<style lang="less" scoped>
a {
  text-decoration: none;
}
ul,
li,
p {
  margin: 0;
  padding: 0;
}
ul {
  margin: 20px 0 0 -29px;
  display: flex;
  justify-content: left;
  align-items: center;
  flex-wrap: wrap;
  li {
    list-style: none;
    width: 137px;
    height: 140px;
    padding-left: 22px;
    .cov {
      width: 137px;
      height: 103px;
      position: relative;
      cursor: pointer;
      img {
        display: block;
        width: 100%;
        height: 100%;
      }
      .iconfont {
        position: absolute;
        width: 25px;
        height: 25px;
        font-size: 30px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #666;
      }
      .iconfont:hover {
        color: #333;
      }
    }
    .dec {
      cursor: pointer;
      margin: 8px 0 3px;
      font-size: 14px;
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      word-wrap: normal;
    }
    .dec:hover {
      text-decoration: underline;
    }
  }
}
</style>
